from .database import DatabaseConnectionManager
from sqlalchemy.engine import create_engine, Engine

class OpenGaussConnectionManager(DatabaseConnectionManager):
    provider:str="opengauss"
    def __init__(self, config_file: str):
        super().__init__(config_file)
    def create_engine(self) -> Engine:
        # reference:
        # https://cloud.tencent.com/developer/ask/sof/106578644
        from sqlalchemy.dialects.postgresql.base import PGDialect
        PGDialect._get_server_version_info = lambda *args: (9, 2)
        return create_engine(self.dsn, pool_pre_ping=True)
